package rps.client.ui;

import java.awt.Image;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public enum Picture {
	DARK_GRASS, LIGHT_GRASS, SCISSOR, DSCISSOR, ROCK, DROCK, PAPER, DPAPER, FOG, TRAP, FLAG, SCISSOR1, ROCK1, PAPER1, FLAG1, RIGHT, 
	LEFT, UP, DOWN, ATTACK, startupPanelBG, EMPTY_GRASS;
	
	Icon image;
	String path;
	static String projPath = System.getProperty("user.dir");
	private static String imagesPath = "/src/board/normal/";
	private static String darkGrassPath = projPath + imagesPath + "darkgrass.png";
	private static String lightGrassPath = projPath + imagesPath + "lightgrass.png";
	private static String background = darkGrassPath; 
	static {
		init();
	}
	private static void init() {
			
		darkGrassPath = projPath + imagesPath + "darkgrass.png";
		lightGrassPath = projPath + imagesPath + "lightgrass.png";
		background = darkGrassPath; 
		
		SCISSOR.setPath("scissor0.png");
		DSCISSOR.setPath("scissor.png");
		ROCK.setPath("rock0.png");
		DROCK.setPath("rock.png");
		PAPER.setPath("paper0.png");
		DPAPER.setPath("paper.png");
		FOG.setPath("fog.png");
		TRAP.setPath("trap.png");
		FLAG.setPath("flag.png");
		SCISSOR1.setPath("scissor1.png");
		ROCK1.setPath("rock1.png");
		PAPER1.setPath("paper1.png");
		FLAG1.setPath("flag1.png");
		RIGHT.setPath("right.png");
		LEFT.setPath("left.png");
		UP.setPath("up.png");
		DOWN.setPath("down.png");
		ATTACK.setPath("attack.png");
		EMPTY_GRASS.setPath("invisible.png");
		
		startupPanelBG.setPath("startupPanelBG.png");
		
		DARK_GRASS.setImage(darkGrassPath);
		LIGHT_GRASS.setImage(lightGrassPath);
		SCISSOR.setImage(SCISSOR.path);
		DSCISSOR.setImage(DSCISSOR.path);
		ROCK.setImage(ROCK.path);
		DROCK.setImage(DROCK.path);
		PAPER.setImage(PAPER.path);
		DPAPER.setImage(DPAPER.path);
		FOG.setImage(FOG.path);
		TRAP.setImage(TRAP.path);
		FLAG.setImage(FLAG.path);
		SCISSOR1.setImage(SCISSOR1.path);
		ROCK1.setImage(ROCK1.path);
		PAPER1.setImage(PAPER1.path);
		FLAG1.setImage(FLAG1.path);
		RIGHT.setImage(RIGHT.path);
		LEFT.setImage(LEFT.path);
		UP.setImage(UP.path);
		DOWN.setImage(DOWN.path);
		ATTACK.setImage(ATTACK.path);
		EMPTY_GRASS.setImage(EMPTY_GRASS.path);
		startupPanelBG.setImage(startupPanelBG.path);
	}
	
	private void setImage (String path){
		this.image = new ImageIcon(path);
	}
	
	public String getPath () {
		return path;
	}
	
	public static void chooseDesign(String choose){
		imagesPath="/src/board/"+choose+"/";
		init();
	}
	
	private void setPath(String path) {
		this.path = "" + projPath + imagesPath + path;
	}
	public static void updateBackground(boolean odd){
		if(odd)
			background = lightGrassPath;
		else
			background = darkGrassPath;
	}
	
	public Icon getImage () {
		return this.image;
	}
}
